x11: Fix return value of get_device_state
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 20:20:34 +0000 (16:20 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 26 Aug 2020 21:56:41 +0000 (17:56 -0400)
We need to look a the position, not the child surface.

gdk/x11/gdksurface-x11.c

index 2c3cdf86b488980b51149f2ccca9df723920f4ea..d7ed8d034a1a68a52cae6f32a71549adbce5c95b 100644 (file)
@@ -2659,19 +2659,18 @@ gdk_x11_surface_get_frame_extents (GdkSurface    *surface,
 }
 
 static gboolean
-gdk_x11_surface_get_device_state (GdkSurface       *surface,
-                                 GdkDevice       *device,
-                                 double          *x,
-                                 double          *y,
-                                 GdkModifierType *mask)
+gdk_x11_surface_get_device_state (GdkSurface     *surface,
+                                  GdkDevice       *device,
+                                  double          *x,
+                                  double          *y,
+                                  GdkModifierType *mask)
 {
-  GdkSurface *child;
-
   if (GDK_SURFACE_DESTROYED (surface))
     return FALSE;
 
-  gdk_x11_device_xi2_query_state (device, surface, &child, x, y, mask);
-  return child != NULL;
+  gdk_x11_device_xi2_query_state (device, surface, NULL, x, y, mask);
+
+  return *x >= 0 && *y >= 0 && *x < surface->width && *y < surface->height;
 }
 
 static void